<template>
  <div class="search">
    <div class="Item" v-for="(item,index) in datas" :key="index" >
      <img :src="item.img" alt="" class="pic">
      <p class="title">{{item.title}}</p>
      <span class="like">{{item.like}}人喜欢</span>
      <span class="collect">{{item.collect}}人收藏</span>
    </div>
  </div>
</template>

<script>
export default {
  data(){
    return{
      datas:[]
    }
  },
  mounted(){
    var kw=this.$route.query.kw;
    var url="http://localhost:8080/home/search?kw="+kw;
     this.axios(url).then(res => {
      this.datas = res.data;
      console.log(res.data);
    });
  }
}
</script>

<style scoped>
.search{
  width:100%;
  display: flex;
  flex-direction: row;
  justify-content: space-between;
  box-sizing: border-box;
  padding: 10px 20px;
  flex-wrap: wrap;
}
.Item{
  width: 28%;
  height: auto;
  margin: 20px 10px;
  border:1px solid #333;
  box-sizing: border-box;
  padding: 6px;
}
.pic{
 width:100%;
  margin-bottom: 5px;
}
.title{
  background: #eee;
  font-size: 16px;
  margin: 5px 0;

}
.like,.collect{
  font-size: 12px;
  margin: 5px 5px
}
</style>